The memset in init_switch_stack is overwriting the processor stack.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 31 Jan 2006 23:56:19 +0000 (00:56 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 31 Jan 2006 23:56:19 +0000 (00:56 +0100)
We need to avoid manipulating the switch stack area of the currently
running cpu.  Original patch by Kevin Tian.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
xen/arch/ia64/xen/domain.c

index a331141976a27dc6317c4bc2868f6550b7decc0f..379e47812f226316865e217f316a878ab54a2cfc 100644 (file)
@@ -157,14 +157,14 @@ struct vcpu *alloc_vcpu_struct(struct domain *d, unsigned int vcpu_id)
            if ((v = alloc_xenheap_pages(KERNEL_STACK_SIZE_ORDER)) == NULL)
                return NULL;
            memset(v, 0, sizeof(*v)); 
-       }
 
-       ti = alloc_thread_info(v);
-       /* Clear thread_info to clear some important fields, like
-        * preempt_count
-        */
-       memset(ti, 0, sizeof(struct thread_info));
-       init_switch_stack(v);
+           ti = alloc_thread_info(v);
+           /* Clear thread_info to clear some important fields, like
+            * preempt_count
+            */
+           memset(ti, 0, sizeof(struct thread_info));
+           init_switch_stack(v);
+       }
 
        if (!is_idle_domain(d)) {
            v->arch.privregs =